/***********************************************************************
 * Copyright (c) Darren Carlson
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License (LGPL)
 * as published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public 
 * License along with this program; if not, write to the
 * Free Software Foundation, Inc., 
 * 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 ***********************************************************************/
using System;
using System.Collections.Generic;
using System.Text;

namespace OceanDebugger
{
    class RequestConfig
    {
        public string Server;
        public string BaseURLString = "/resource/contextualize";
        public string CallURL;
        private string PostDataString = "";
        public string WebMethod = "POST";
        public string ContentType = "text/xml";
        public System.Windows.Forms.RichTextBox PostDataTarget;
        public System.Windows.Forms.TextBox GetDataTarget;
        public string xmlPath;
        
        public RequestConfig(String serverURL)
        {
            this.Server = serverURL;
        }

        public string BaseURL
        {
            set
            {
                this.BaseURLString = value;
            }
            get
            {
                if (this.WebMethod.Equals("GET") && GetDataTarget != null)
                {
                    return this.Server + this.BaseURLString + GetDataTarget.Text;
                }
                else
                {
                    return this.Server + this.BaseURLString;
                }                
            }
        }

        public string PostData
        {
            get
            {
                if (PostDataTarget != null)
                {
                    return PostDataTarget.Text;
                }
                else
                {
                    return PostDataString;
                }
            }

            set
            {
                this.PostDataString = value;
            }
        }
    }
}
